home *** CD-ROM | disk | FTP | other *** search
/ Meeting Pearls 2 / Meeting Pearls Vol. II (1995)(GTI - Schatztruhe)[!].iso / Pearls / dev / Oberon_Interfaces / Interfaces / Workbench.mod < prev   
Text File  |  1995-01-12  |  9KB  |  236 lines

  1. (*
  2. (*
  3. **  Amiga Oberon Interface Module:
  4. **  $VER: Workbench.mod 40.15 (12.1.95) Oberon 3.6
  5. **
  6. **   © 1993 by Fridtjof Siebert
  7. **   updated for V39, V40 by hartmut Goebel
  8. *)
  9. *)
  10.  
  11. MODULE Workbench;
  12.  
  13. IMPORT
  14.   e   * := Exec,
  15.   I   * := Intuition,
  16.   d   * := Dos,
  17.   u   * := Utility,
  18.   sys * := SYSTEM;
  19.  
  20.  
  21. TYPE
  22.  
  23.   WBArgPtr * = UNTRACED POINTER TO WBArg;
  24.   WBArg * = STRUCT
  25.     lock * : d.FileLockPtr;     (* a lock descriptor *)
  26.     name * : e.LSTRPTR;         (* a string relative to that lock *)
  27.   END;
  28.  
  29.   WBArguments * = ARRAY MAX(LONGINT) DIV SIZE(WBArg) -1 OF WBArg;
  30.   WBArgumentsPtr * = UNTRACED POINTER TO WBArguments;
  31.  
  32.   WBStartupPtr * = UNTRACED POINTER TO WBStartup;
  33.   WBStartup * = STRUCT (message * : e.Message) (* a standard message structure *)
  34.     process * : d.ProcessId;     (* the process descriptor for you *)
  35.     segment * : e.BPTR;          (* a descriptor for your code *)
  36.     numArgs * : LONGINT;         (* the number of elements in ArgList *)
  37.     toolWindow * : e.LSTRPTR;    (* description of window *)
  38.     argList * : WBArgumentsPtr;  (* the arguments themselves *)
  39.   END;
  40.  
  41. CONST
  42.  
  43.   disk      * = 1;
  44.   drawer    * = 2;
  45.   tool      * = 3;
  46.   project   * = 4;
  47.   garbage   * = 5;
  48.   device    * = 6;
  49.   kick      * = 7;
  50.   wbAppIcon * = 8;
  51.  
  52. TYPE
  53.  
  54.   OldDrawerDataPtr * = UNTRACED POINTER TO OldDrawerData;
  55.   OldDrawerData * = STRUCT       (* pre V36 definition *)
  56.    (newWindow * : I.NewWindow)   (* args to open window *)
  57.     currentX  * : LONGINT;       (* current x coordinate of origin *)
  58.     currentY  * : LONGINT;       (* current y coordinate of origin *)
  59.   END;
  60.  
  61. CONST
  62.  
  63. (* the amount of DrawerData actually written to disk *)
  64.   oldDrawerDataFileSize * = sys.SIZE(OldDrawerData);
  65.  
  66. TYPE
  67.  
  68.   DrawerDataPtr * = UNTRACED POINTER TO DrawerData;
  69.   DrawerData * = STRUCT (newWindow * : I.NewWindow) (* args to open window *)
  70.     currentX * : LONGINT;        (* current x coordinate of origin *)
  71.     currentY * : LONGINT;        (* current y coordinate of origin *)
  72.     flags * : LONGSET;           (* flags for drawer *)
  73.     viewModes * : SET;           (* view mode for drawer *)
  74.   END;
  75.  
  76. CONST
  77.  
  78. (* the amount of DrawerData actually written to disk *)
  79.   drawerDataFileSize * = sys.SIZE(DrawerData);
  80.  
  81. TYPE
  82.  
  83.   DiskObjectPtr * = UNTRACED POINTER TO DiskObject;
  84.   DiskObject * = STRUCT
  85.     magic * : INTEGER; (* a magic number at the start of the file *)
  86.     version * : INTEGER; (* a version number, so we can change it *)
  87.     gadget * : I.Gadget;      (* a copy of in core gadget *)
  88.     type * : SHORTINT;
  89.     defaultTool * : e.LSTRPTR;
  90.     toolTypes * : e.APTR;
  91.     currentX * : LONGINT;
  92.     currentY * : LONGINT;
  93.     drawerData * : DrawerDataPtr;
  94.     toolWindow * : e.LSTRPTR; (* only applies to tools *)
  95.     stackSize * : LONGINT;    (* only applies to tools *)
  96.   END;
  97.  
  98. CONST
  99.   
  100.   diskMagic    * = 0E310U;  (* a magic number, not easily impersonated *)
  101.   diskVersion  * = 1;       (* our current version number *)
  102.   diskRevision * = 1;       (* our current revision number *)
  103. (* I only use the lower 8 bits of Gadget.userData for the revision # *)
  104.   diskRevisionMask * = 0FFH;
  105.  
  106. TYPE
  107.  
  108.   FreeListPtr * = UNTRACED POINTER TO FreeList;
  109.   FreeList * = STRUCT
  110.     numFree * : INTEGER;
  111.     memList * : e.List;
  112.   END;
  113.  
  114. CONST
  115.  
  116. (* each message that comes into the WorkBenchPort must have a type field
  117. ** in the preceeding short.  These are the defines for this type
  118. *)
  119.  
  120.   appWindow     * = 7;      (* msg from an app window *)
  121.   appIcon       * = 8;      (* msg from an app icon *)
  122.   appMenuItem   * = 9;      (* msg from an app menuitem *)
  123.  
  124. (* workbench does different complement modes for its gadgets.
  125. ** It supports separate images, complement mode, and backfill mode.
  126. ** The first two are identical to intuitions GFLG_GADGIMAGE and GFLG_GADGHCOMP.
  127. ** backfill is similar to GFLG_GADGHCOMP, but the region outside of the
  128. ** image (which normally would be color three when complemented)
  129. ** is flood-filled to color zero.
  130. *)
  131.   gadgBackFill * = {0};
  132.  
  133. (* if an icon does not really live anywhere, set its current position
  134. ** to here
  135. *)
  136.   noIconPosition * = 80000000H;
  137.  
  138. (* workbench now is a library.  this is it's name *)
  139.   workbenchName * = "workbench.library";
  140.  
  141. (* If you find AppMessage.Version >= amVersion, you know this structure has
  142.  * at least the fields defined in this version of the include file
  143.  *)
  144.   amVersion * = 1;
  145.  
  146. TYPE
  147.  
  148.   AppMessagePtr * = UNTRACED POINTER TO AppMessage;
  149.   AppMessage * = STRUCT (message * : e.Message) (* standard message structure *)
  150.     type * : INTEGER;             (* message type               *)
  151.     userData * : e.APTR;          (* application specific       *)
  152.     id * : LONGINT;               (* application definable ID   *)
  153.     numArgs * : LONGINT;          (* # of elements in arglist   *)
  154.     argList * : WBArgumentsPtr;   (* the arguements themselves  *)
  155.     version * : INTEGER;          (* will be AM_VERSION         *)
  156.     class * : SET;                (* message class              *)
  157.     mouseX * : INTEGER;           (* mouse x position of event  *)
  158.     mouseY * : INTEGER;           (* mouse y position of event  *)
  159.     seconds * : LONGINT;          (* current system clock time  *)
  160.     micros * : LONGINT;           (* current system clock time  *)
  161.     reserved * : ARRAY 8 OF LONGINT;    (* avoid recompilation  *)
  162.   END;
  163.  
  164. (*
  165.  * The following structures are private.  These are just stub
  166.  * structures for code compatibility...
  167.  *)
  168.  
  169.   AppWindowPtr * = UNTRACED POINTER TO STRUCT END;
  170.   AppIconPtr * = UNTRACED POINTER TO STRUCT END;
  171.   AppMenuItemPtr * = UNTRACED POINTER TO STRUCT END;
  172.  
  173. VAR
  174.   base * : e.LibraryPtr;
  175.  
  176. (* --- functions in V36 or higher (Release 2.0) --- *)
  177. (* --- REMEMBER: You have to ensure that Workbench.base#NIL    --- *)
  178. (* ---           BEFORE you use the following Prozedures!      --- *)
  179. PROCEDURE StartWorkbench   *{base,- 42}(flags{0}      : LONGSET;
  180.                                         ptr{1}        : LONGINT): BOOLEAN;
  181. PROCEDURE AddAppWindowA    *{base,- 48}(id{0}         : LONGINT;
  182.                                         userdata{1}   : e.APTR;
  183.                                         window{8}     : I.WindowPtr;
  184.                                         msgport{9}    : e.MsgPortPtr;
  185.                                         taglist{10}   : ARRAY OF u.TagItem): AppWindowPtr;
  186. PROCEDURE AddAppWindow     *{base,- 48}(id{0}         : LONGINT;
  187.                                         userdata{1}   : e.APTR;
  188.                                         window{8}     : I.WindowPtr;
  189.                                         msgport{9}    : e.MsgPortPtr;
  190.                                         tag1{10}..    : u.Tag): AppWindowPtr;
  191. PROCEDURE RemoveAppWindow  *{base,- 54}(appWindow{8}  : AppWindowPtr): BOOLEAN;
  192. PROCEDURE AddAppIconA      *{base,- 60}(id{0}         : LONGINT;
  193.                                         userdata{1}   : e.APTR;
  194.                                         text{8}       : ARRAY OF CHAR;
  195.                                         msgport{9}    : e.MsgPortPtr;
  196.                                         lock{10}      : d.FileLockPtr;
  197.                                         diskobj{11}   : DiskObjectPtr;
  198.                                         taglist{12}   : ARRAY OF u.TagItem): AppIconPtr;
  199. PROCEDURE AddAppIcon       *{base,- 60}(id{0}         : LONGINT;
  200.                                         userdata{1}   : e.APTR;
  201.                                         text{8}       : ARRAY OF CHAR;
  202.                                         msgport{9}    : e.MsgPortPtr;
  203.                                         lock{10}      : d.FileLockPtr;
  204.                                         diskobj{11}   : DiskObjectPtr;
  205.                                         tag1{12}..    : u.Tag): AppIconPtr;
  206. PROCEDURE RemoveAppIcon    *{base,- 66}(appIcon{8}    : AppIconPtr): BOOLEAN;
  207. PROCEDURE AddAppMenuItemA  *{base,- 72}(id{0}         : LONGINT;
  208.                                         userdata{1}   : e.APTR;
  209.                                         text{8}       : ARRAY OF CHAR;
  210.                                         msgport{9}    : e.MsgPortPtr;
  211.                                         taglist{10}   : ARRAY OF u.TagItem): AppMenuItemPtr;
  212. PROCEDURE AddAppMenuItem   *{base,- 72}(id{0}         : LONGINT;
  213.                                         userdata{1}   : e.APTR;
  214.                                         text{8}       : ARRAY OF CHAR;
  215.                                         msgport{9}    : e.MsgPortPtr;
  216.                                         tag1{10}..    : u.Tag): AppMenuItemPtr;
  217. PROCEDURE RemoveAppMenuItem*{base,- 78}(appMenuItem{8}: AppMenuItemPtr): BOOLEAN;
  218.  
  219. (*--- functions in V39 or higher (Release 3) ---*)
  220.  
  221. PROCEDURE WBInfo           *{base,-05AH}(lock{8}      : d.FileLockPtr;
  222.                                          name{9}      : ARRAY OF CHAR;
  223.                                          screen{10}   : I.ScreenPtr);
  224.  
  225.  
  226. (* $OvflChk- $RangeChk- $StackChk- $NilChk- $ReturnChk- $CaseChk- *)
  227.  
  228. BEGIN
  229.   base :=  e.OpenLibrary(workbenchName,37);
  230.  
  231. CLOSE
  232.   IF base#NIL THEN e.CloseLibrary(base) END;
  233.  
  234. END Workbench.
  235.  
  236.